
--2秒后开始选择魔石和难度
ac.wait(1000,function()
    local online = nil
    ac.each_player(function(player)
        online = online or player
    end)
    --ac.game:notify('游戏-选择模式',online)
    ac.game:notify('游戏-选择难度',online)
end)

--6小时必定退出
ac.end_game_timer = ac.wait(6*60*60*1000,function()
    CustomVictoryBJ(ac.player[1].handle, true, true)
    CustomVictoryBJ(ac.player[2].handle, true, true)
    CustomVictoryBJ(ac.player[3].handle, true, true)
    CustomVictoryBJ(ac.player[4].handle, true, true)
    ac.wait(5000,function()
        ac.game:end_game()
    end)
end)

--ac.game:event '游戏-选择模式'(function(_,player)
--    local dialog = player:create_dialog({
--        '选择模式',
--        {'常规模式'},
--    })
--
--    function dialog:on_click(name)
--        ac.game:notify('游戏-选择难度',player,name)
--    end
--end)

ac.game:event '游戏-选择难度'(function(_,player,name)
    local dialog = ac.dialog('选择难度')
    local num = 3
    
    for a=1,num do
        dialog:add_button({
            key = ('难度%s'):format(a),
            index = a,
        })
    end
    
    function dialog:on_click(button, player)
        dialog:hide()
        ac.game:notify('游戏-设置难度',button.index,name)
        ac.game:notify('游戏-设置难度结束',button.index,name)
    end

    if player:is_self() then
        dialog:show() 
    end
end)
